package com.itheima.controller;


import com.itheima.Service.UserService;
import com.itheima.pojo.Result;
import com.itheima.pojo.User;
import com.itheima.utils.BaseContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/user/info")
    public Result selectUserInfo(){
        Integer id = BaseContext.getCurrentId();
        log.info("根据id{}查询用户信息：",id);
        User user = userService.getUserById(id);
        return Result.success(user);
    }


}
